package com.suse.common.util.regex;

import static com.suse.common.util.regex.RegexConstant.*;

/**
 * <p>
 * 正则工具类
 * </p>
 *
 * @author 辜玉彬
 * @since 2022-10-22 10:50
 */
public class RegexUtil {

    public static boolean isNotPhone(String phone) {
        return isNotMatchs(PHONE_REGEX,phone);
    }

    public static boolean isNotEmail(String email) {
        return isNotMatchs(EMAIL_REGEX,email);
    }

    public static boolean isNotPassword(String password) {
        return isNotMatchs(PASSWORD_REGEX,password);
    }

    public static boolean isNotCode(String code) {
        return isNotMatchs(CODE_REGEX,code);
    }

    public static boolean isNotMatchs(String regex,String content) {
        if (regex == null || content == null) return true;
        return ! content.matches(regex);
    }

}
